<?php
session_start();
include_once  dirname(__FILE__).'./../../../module/common/config.inc.php';
//if (!$login){ include_once 'limit.php'; }
include_once SITE_ROOT.'module/common/db_mysql.inc.php';
include_once SITE_ROOT.'lib/smarty/Smarty.class.php'; //包含smarty类文件

$t = new Smarty();  //建立smarty实例对象$smarty
$t->template_dir = SITE_ROOT.'/theme/default/';
$t->compile_dir  = SITE_ROOT.'/theme/templates_c/';
$t->compile_id = 'index_static';
//$t->cache_dir = WEB_ROOT.'admin/_cache/';
$t->caching      = false;
$t->left_delimiter 	= "{{";
$t->right_delimiter = "}}";
$outvar[img_url] = '/theme/default/images/';
$outvar[css_url] = '/theme/default/css/';
$outvar[js_url] = '/theme/default/js/';
$outvar[csslist][] = $outvar[css_url].'index.css';
$outvar[jslist][] = '';
$outvar[headtitle] = SITE_NAME;
$outvar[headkeyword] = SITE_KEYWORD;
$outvar[headdescription] = SITE_DESCRIPTION;
$outvar[filename] = $php_self_name;

function staticFile($outFileName,$mainT='main'){
	global $t,$outvar;
	assignMore($outvar);
	$output = $t->fetch($mainT.'.html');
	makedir($outFileName,0777,true);
	$fp=fopen($outFileName,"w"); //"w"打开文件方式为写入，文件指针置于于文件头，并将原文件长度设为０，若文件不存在，存创建之。
	fwrite($fp,$output);
	return fclose($fp);
}

